/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dlc.modelo;

import dlc.persistencia.BaseDatos;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Singleton del Vocabulario
 * 
 */
public class Vocabulario {

    private Map<String, Palabra> terminos;
    private List<Palabra> terminosList;
    private static Vocabulario vocabulario;

    private Vocabulario() throws Exception {
        terminos = new HashMap<String, Palabra>();
        terminosList = new ArrayList<Palabra>();
        cargarVocabulario();
    }

    public static Vocabulario getInstance() throws Exception {
        if (vocabulario == null) {
            return vocabulario = new Vocabulario();
        } else {
            return vocabulario;
        }
    }

    private void cargarVocabulario() throws Exception {
        
            BaseDatos dao = new BaseDatos(2);
            dao.obtenerVocabulario(this.terminos);
            
    }

    public Palabra getPalabra(String termino) {
        return terminos.get(termino);
    }

    public Map<String, Palabra> getTerminos() {
        return terminos;
    }

    public void setTerminos(Map<String, Palabra> terminos) {
        this.terminos = terminos;
    }
}
